﻿using UnityEngine;
using UnityEngine.UI;
using Localize;
namespace UnityEngine.UI
{
    [AddComponentMenu("UI/UIText(localizition)")]
    public class UIText : Text
    {
        [HideInInspector]
        public string mKey;

        // Use this for initialization

        protected override void Start()
        {
            base.Start();
            this.text = i18n._(mKey, this.text);
        }
        public string Key
        {
            get { return mKey; }
            set
            {
                mKey = value;
                this.text = i18n._(mKey, this.text);
            }
        }

        [ContextMenu("Refresh")]
        public void Refresh()
        {
            if (string.IsNullOrEmpty(mKey)) return;
            this.text = i18n._(mKey, this.text);
        }
    }
}

